package org.example.erp.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import lombok.Data;

/**
 * 工作站管理表
 * @TableName workstation
 */
@TableName(value ="workstation")
@Data
public class Workstation implements Serializable {
    /**
     * 工作站编号
     */
    @TableId(type = IdType.AUTO)
    private Integer workstationId;

    /**
     * 工作站编码
     */
    private String workstationCode;
    /**
     * 工作站名称
     */
    private String workstationName;

    /**
     * 工作站地点
     */
    private String workstationLocation;

    /**
     * 所在车间
     */
    private String workshopCode;

    /**
     * 所属工序
     */
    private String processCode;

    /**
     * 状态（是否启用）
     */
    private String status;

    /**
     * 备注
     */
    private String remark;
    @TableField(exist = false)
    private Workshop workshop;
    @TableField(exist = false)
    private Process process;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Workstation other = (Workstation) that;
        return (this.getWorkstationId() == null ? other.getWorkstationId() == null : this.getWorkstationId().equals(other.getWorkstationId()))
            && (this.getWorkstationCode() == null ? other.getWorkstationCode() == null : this.getWorkstationCode().equals(other.getWorkstationCode()))
            && (this.getWorkstationLocation() == null ? other.getWorkstationLocation() == null : this.getWorkstationLocation().equals(other.getWorkstationLocation()))
            && (this.getWorkshopCode() == null ? other.getWorkshopCode() == null : this.getWorkshopCode().equals(other.getWorkshopCode()))
            && (this.getProcessCode() == null ? other.getProcessCode() == null : this.getProcessCode().equals(other.getProcessCode()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
            && (this.getRemark() == null ? other.getRemark() == null : this.getRemark().equals(other.getRemark()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getWorkstationId() == null) ? 0 : getWorkstationId().hashCode());
        result = prime * result + ((getWorkstationCode() == null) ? 0 : getWorkstationCode().hashCode());
        result = prime * result + ((getWorkstationLocation() == null) ? 0 : getWorkstationLocation().hashCode());
        result = prime * result + ((getWorkshopCode() == null) ? 0 : getWorkshopCode().hashCode());
        result = prime * result + ((getProcessCode() == null) ? 0 : getProcessCode().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getRemark() == null) ? 0 : getRemark().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", workstationId=").append(workstationId);
        sb.append(", workstationCode=").append(workstationCode);
        sb.append(", workstationLocation=").append(workstationLocation);
        sb.append(", workshopCode=").append(workshopCode);
        sb.append(", processCode=").append(processCode);
        sb.append(", status=").append(status);
        sb.append(", remark=").append(remark);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}